package com.dunshan.jmetershell.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;

/**
 * @description: md5加密测试
 * @author: 李文
 * @create: 2021-05-06 20:43
 **/
@Controller
public class IndexMdController {


    String md = "58FB3DDC445E2C9C2413C5C5BEE516AE";

    @GetMapping("/api/md5")
    @ResponseBody
    public Object getMdTest(String md5) {
        HashMap<String, Object> map = new HashMap<>();
        if (md5.equals(md)) {
            map.put("md5", md5);
            map.put("ok", "请求成功");
        } else {
            Date date = new Date();
            SimpleDateFormat sdf = new SimpleDateFormat("YYYY/MM/dd HH:mm:ss.SSS");
            String format = sdf.format(date);
            map.put("error", "请求失败！");
            map.put("date", format);
        }

        return map;

    }
}

